package com.yangyang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yangyang.dao.OrderDao;
import com.yangyang.entity.Order;
import com.yangyang.entity.QueryVo;
import com.yangyang.entity.User;
import com.yangyang.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderDao dao;

    @Override
    public User getUser(User user) {
        return dao.getUser(user);
    }

    @Override
    public PageInfo<Order> list(QueryVo vo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<Order> orderPageInfo = new PageInfo<Order>(dao.list(vo));
        return orderPageInfo;
    }

    @Override
    public int add(Order order) {
        return dao.add(order);
    }

    @Override
    public List<Order> getlist() {
        return dao.getlist();
    }
}
